package com.ys.service.base.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSON;
import com.ys.dto.AddDto;
import com.ys.dto.EditDto;
import com.ys.entity.base.TbSite;
import com.ys.mapper.base.TbSiteMapper;
import com.ys.service.base.TbSiteService;
import com.ys.vo.R;

@Service("tbSiteService")
public class TbSiteServiceImpl implements TbSiteService {
	
	@Autowired
	private TbSiteMapper tbSiteMapper;
	
	@Override
	public R add(Map<String, Object> params) {
		
		TbSite entity = JSON.parseObject(JSON.toJSONString(params), TbSite.class);
		tbSiteMapper.insert(entity);
		return R.ok(AddDto.closeAndReload());
	}
	
	@Override
	public R edit(Map<String, Object> params) {

		TbSite entity = JSON.parseObject(JSON.toJSONString(params), TbSite.class);
		tbSiteMapper.update(entity);

		return R.ok(EditDto.closeAndReload());
	}

}
